﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Admin/MasterPage/Home.Master" AutoEventWireup="true" CodeBehind="Search.aspx.cs" Inherits="TTMarketing.Admin.Search" %>
<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHeader" runat="server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceMain" runat="server">
     <asp:Panel ID="plContent" runat="server">
        <div id="close">
            <table width="100%">
                <tr>
                    <td>
                        <asp:Label ID="lblTitle" runat="server" Style="font-size: 30px" 
                            Text="Tím kiếm"></asp:Label>
                    </td>
                    <td align="right" width="100px">
                        <asp:Label ID="lblStt" runat="server" Text="Trạng thái "></asp:Label>
                        <telerik:RadComboBox ID="cmbClose" runat="server" AutoPostBack="True" OnSelectedIndexChanged="cmbClose_SelectedIndexChanged"
                            Width="100px">
                            <Items>
                                <telerik:RadComboBoxItem runat="server" Text="Open" Value="1" />
                                <telerik:RadComboBoxItem runat="server" Text="Close" Value="0" />
                            </Items>
                        </telerik:RadComboBox>
                    </td>
                </tr>
            </table>
        </div>
        <div id="divmessage2" runat="server">
        </div>
        <asp:Panel ID="plDetail" runat="server" Width="100%">
            <fieldset>
                <legend>Thông tin tìm kiếm</legend>
                <table width="100%">
                    <tr>
                        <td width="200px">
                            <asp:Label ID="lblUserName0" runat="server" Text="Tên loại tìm kiếm"></asp:Label>
                            <asp:ObjectDataSource ID="odsTypeSearch" runat="server" SelectMethod="getAll" 
                                TypeName="TTBusiness.ClassDB.clsBSTypeSearch"></asp:ObjectDataSource>
                        </td>
                        <td>
                            <telerik:RadComboBox ID="cmbTypeSearch" Runat="server" 
                                DataSourceID="odsTypeSearch" DataTextField="Name" DataValueField="ID" 
                                Width="100%" AutoPostBack="True" 
                                onselectedindexchanged="cmbTypeSearch_SelectedIndexChanged" 
                                ondatabinding="cmbTypeSearch_DataBinding" ondatabound="cmbTypeSearch_DataBound">
                            </telerik:RadComboBox>
                        </td>
                    </tr>
                    <tr>
                        <td width="200px">
                            <asp:Label ID="lblUserName" runat="server" Text="Tên tìm kiếm"></asp:Label>
                        </td>
                        <td>
                            <telerik:RadTextBox ID="txtName" runat="server" ValidationGroup="a" 
                                Width="100%">
                            </telerik:RadTextBox>
                        </td>
                    </tr>
                    <tr>
                        <td width="200px">
                            &nbsp;
                        </td>
                        <td>
                            <asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server" ControlToValidate="txtName"
                                Display="Dynamic" ErrorMessage="Tên không được rỗng" Style="font-size: small;
                                font-style: italic; color: #FF9900" ValidationGroup="a"></asp:RequiredFieldValidator>
                        </td>
                    </tr>
                    <tr>
                        <td>
                            &nbsp;
                        </td>
                        <td>
                             <asp:Button ID="btnSaveNew" runat="server" Text="Lưu mới" CssClass="botton" ToolTip="Lưu bản ghi mới"
                                OnClick="btnSaveNew_Click" ValidationGroup="a" />
                            &nbsp;<asp:Button ID="btnSave" runat="server" CssClass="botton" Text="Lưu sửa" ToolTip="Cập nhật bản ghi hiện hành"
                                OnClick="btnSave_Click" ValidationGroup="a" />
                             &nbsp;<asp:Button ID="btnClear" runat="server" CssClass="botton" OnClick="btnClear_Click"
                                Text="Reset" ToolTip="Nhập lại dữ liệu" />
                        </td>
                    </tr>
                </table>
                <br />
                <asp:HiddenField ID="hfId" runat="server" />
                <br />
            </fieldset>
        </asp:Panel>
        <asp:Panel ID="Panel2" runat="server" Width="100%">
            <telerik:RadGrid ID="rgdGrid" runat="server" AllowPaging="True" AllowSorting="True"
                DataSourceID="odsSearch" GridLines="None" ShowFooter="True" 
                onitemcommand="rgdGrid_ItemCommand" 
                onselectedindexchanged="RadGrid1_SelectedIndexChanged">
                <ClientSettings AllowColumnsReorder="True" ReorderColumnsOnClient="True" EnablePostBackOnRowClick="True"
                    EnableRowHoverStyle="True">
                    <Selecting AllowRowSelect="True" />
                </ClientSettings>
                <MasterTableView AutoGenerateColumns="False" DataSourceID="odsSearch">
                    <RowIndicatorColumn>
                        <HeaderStyle Width="20px" />
                    </RowIndicatorColumn>
                    <ExpandCollapseColumn>
                        <HeaderStyle Width="20px" />
                    </ExpandCollapseColumn>
                    <Columns>
                        <telerik:GridBoundColumn DataField="ID" DataType="System.Int32" HeaderText="Mã" SortExpression="ID"
                            UniqueName="ID">
                        </telerik:GridBoundColumn>
                        <telerik:GridBoundColumn DataField="Name" HeaderText="Tên tìm kiếm" SortExpression="Name"
                            UniqueName="Name">
                        </telerik:GridBoundColumn>
                        <telerik:GridBoundColumn DataField="tblTypeSearch.Name" DataType="System.String" 
                            HeaderText="Tên loại" SortExpression="tblTypeSearch.Name" UniqueName="TypeName">
                        </telerik:GridBoundColumn>
                        <telerik:GridTemplateColumn HeaderText="Action" UniqueName="TemplateColumn">
                            <ItemTemplate>
                                <asp:ImageButton ID="ImageButton2" runat="server" ImageUrl="~/Admin/Images/Button/Delete_Grid.gif"
                                    CommandArgument='<%# Eval("ID") %>' CommandName="delete" OnClientClick=" return confirm(&quot;Bạn có chắc chắn muốn xóa?&quot;);" />
                            </ItemTemplate>
                            <ItemStyle Width="40px" />
                        </telerik:GridTemplateColumn>
                    </Columns>
                </MasterTableView>
                <HeaderContextMenu EnableAutoScroll="True">
                </HeaderContextMenu>
            </telerik:RadGrid>
            <asp:ObjectDataSource ID="odsSearch" runat="server" SelectMethod="getByType" 
                TypeName="TTBusiness.ClassDB.clsBSSearch">
                <SelectParameters>
                    <asp:ControlParameter ControlID="cmbTypeSearch" Name="typeid" 
                        PropertyName="SelectedValue" Type="Int32" />
                </SelectParameters>
            </asp:ObjectDataSource>
        </asp:Panel>
    </asp:Panel>
    <telerik:RadAjaxManager runat="server" ID="RadAjaxManager1" EnableHistory="True">
        <AjaxSettings>
            <telerik:AjaxSetting AjaxControlID="btnSaveNew">
                <UpdatedControls>
                    <telerik:AjaxUpdatedControl ControlID="divmessage2" />
                    <telerik:AjaxUpdatedControl ControlID="rgdGrid" />
                    <telerik:AjaxUpdatedControl ControlID="plDetail" LoadingPanelID="Loading" UpdatePanelRenderMode="Inline" />
                </UpdatedControls>
            </telerik:AjaxSetting>
            <telerik:AjaxSetting AjaxControlID="btnSave">
                <UpdatedControls>
                    <telerik:AjaxUpdatedControl ControlID="divmessage2" />
                    <telerik:AjaxUpdatedControl ControlID="rgdGrid" />
                    <telerik:AjaxUpdatedControl ControlID="plDetail" LoadingPanelID="Loading" UpdatePanelRenderMode="Inline" />
                </UpdatedControls>
            </telerik:AjaxSetting>
            <telerik:AjaxSetting AjaxControlID="rgdGrid">
                <UpdatedControls>
                    <telerik:AjaxUpdatedControl ControlID="cmbClose" />
                    <telerik:AjaxUpdatedControl ControlID="divmessage2" />
                    <telerik:AjaxUpdatedControl ControlID="plDetail" LoadingPanelID="Loading" UpdatePanelRenderMode="Inline" />
                </UpdatedControls>
            </telerik:AjaxSetting>
            <telerik:AjaxSetting AjaxControlID="btnReset">
                <UpdatedControls>
                    <telerik:AjaxUpdatedControl ControlID="divmessage2" />
                    <telerik:AjaxUpdatedControl ControlID="rgdGrid" />
                    <telerik:AjaxUpdatedControl ControlID="plDetail" LoadingPanelID="Loading" UpdatePanelRenderMode="Inline" />
                </UpdatedControls>
            </telerik:AjaxSetting>
            <telerik:AjaxSetting AjaxControlID="btnClear">
                <UpdatedControls>
                    <telerik:AjaxUpdatedControl ControlID="divmessage2" />
                    <telerik:AjaxUpdatedControl ControlID="plDetail" LoadingPanelID="Loading" UpdatePanelRenderMode="Inline" />
                </UpdatedControls>
            </telerik:AjaxSetting>
            <telerik:AjaxSetting AjaxControlID="cmbClose">
                <UpdatedControls>
                    <telerik:AjaxUpdatedControl ControlID="divmessage2" />
                    <telerik:AjaxUpdatedControl ControlID="plDetail" LoadingPanelID="Loading" UpdatePanelRenderMode="Inline" />
                </UpdatedControls>
            </telerik:AjaxSetting>
            <telerik:AjaxSetting AjaxControlID="cmbTypeSearch">
                <UpdatedControls>
                    <telerik:AjaxUpdatedControl ControlID="rgdGrid" LoadingPanelID="Loading" UpdatePanelRenderMode="Inline" />
                </UpdatedControls>
            </telerik:AjaxSetting>
        </AjaxSettings>
    </telerik:RadAjaxManager>
</asp:Content>
